package com.alks.pad.controller.stitchAccount;


import com.alks.common.aop.Idempotent;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.pad.data.dto.stitch.StitchInventoryDetailDto;
import com.alks.pad.data.request.stitchAccount.StitchInventoryDRequest;
import com.alks.pad.data.request.stitchAccount.StitchInventoryDetailDRequest2;
import com.alks.pad.data.request.stitchAccount.StitchInventoryRequest;
import com.alks.pad.service.stitchAccount.StitchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/pad/stitchProductionReport") // 统一请求路径前缀
@Api(value = "针车件资App", tags = {"针车件资App-针车报产作业"})
public class StitchProductionReportController {

    @Autowired
    private StitchService StitchInventoryService;

    @WebLogger
    @PostMapping("/getNotReportProductDetails")
    @ApiOperation(value = "待报产指令查询",tags = "针车件资App-针车报产作业")
    public ResponseInfo getNotReportProductDetails(@RequestBody StitchInventoryRequest request){
        return StitchInventoryService.getNotReportProductDetails(request);
    }

    @WebLogger
    @PostMapping("/getReportProductDetails")
    @ApiOperation(value = "已报产完的指令查询",tags = "针车件资App-针车报产作业")
    public ResponseInfo getReportProductDetails(@RequestBody StitchInventoryRequest request){
        return StitchInventoryService.getReportProductDetails(request);
    }

    //@WebLogger
    //@PostMapping("/batchReportProduct")
    //@ApiOperation(value = "批量报产-》待报工序查询",tags = "针车件资App-针车报产作业")
    //public ResponseInfo batchReportProduct(@RequestBody List<StitchInventoryDRequest> request){
    //    return StitchInventoryService.batchReportProduct(request);
    //}

    @WebLogger
    @PostMapping("/getNotReportProcessDetails")
    @ApiOperation(value = "待报工序查询",tags = "针车件资App-针车报产作业")
    public ResponseInfo getNotReportProcessDetails(@RequestBody StitchInventoryRequest request){
        return StitchInventoryService.getNotReportProcessDetails(request);
    }

    @WebLogger
    @PostMapping("/getReportProcessDetails")
    @ApiOperation(value = "已报工序查询",tags = "针车件资App-针车报产作业")
    public ResponseInfo getReportProcessDetails(@RequestBody StitchInventoryRequest request){
        return StitchInventoryService.getReportProcessDetails(request);
    }

    @WebLogger
    @PostMapping("/batchReportProcess")
    @ApiOperation(value = "道序合并报产",tags = "针车件资App-针车报产作业")
    @Idempotent(delKey = true,expireTime = 3,info = "系统繁忙，请稍后刷新后再试")
    public ResponseInfo batchReportProcess(@RequestBody StitchInventoryDetailDRequest2 request){
        return StitchInventoryService.batchReportProcess(request);
    }

    //道序报产已经道序合并报产不能自由录入数据，只能录入人员;录入可以改变人和数量
    @WebLogger
    @PostMapping("/reportProcessByDefineQty")
    @ApiOperation(value = "录入",tags = "针车件资App-针车报产作业")
    @Idempotent(delKey = true,expireTime = 2,info = "系统繁忙，请稍后刷新后再试")
    public ResponseInfo reportProcessByDefineQty(@RequestBody StitchInventoryDetailDRequest2 request){
        return StitchInventoryService.reportProcessByDefineQty(request);
    }

    @WebLogger
    @PostMapping("/deleteReportProcess")
    @ApiOperation(value = "已经报产工序删除",tags = "针车件资App-针车报产作业")
    public ResponseInfo deleteReportProcess(@RequestBody StitchInventoryDetailDto request){
        return StitchInventoryService.deleteReportProcess(request);
    }
}
